<template>
    <view class="p-l-r">
        <template v-for="row in dataRows" :key="row.id">
            <view class="log-item">
                <view>光照值：{{ row.lux }}mg/ML</view>
                <view class='m-t-10'>时间：{{ parseTime(row.time) }}</view>
            </view>
        </template>
    </view>
</template>

<script lang="ts" setup>
    import { dataApi } from '@/api/WaterTest';
    import { parseTime } from '@/utils';
    import { hideLoading, showLoading, useRouter } from '@/utils/framework';
    import { ref } from 'vue';

    const router = useRouter()
    const id = Number(router.params.id)

    const dataRows = ref<any[]>([])

    showLoading()

    dataApi(id).then(r => {
        if(r.success && r.data) {
            for(let i = r.data.length - 1; i >= 0; i --) {
                dataRows.value.push(JSON.parse(r.data[i]))
            }
        }

        hideLoading()
    })





</script>

<style lang="scss" src="./index.scss"></style>